<?php
header('content-type:text/html;charset=utf-8');
$username=md5($_POST['username']);
$password=md5($_POST['password']);
$link=mysql_connect('localhost','root','root') or die('连接失败'.mysql_error());
mysql_select_db('blog',$link);
mysql_set_charset('utf8');
$a="select * from login where `username`='$username'";//var_dump($a);die;
$res=mysql_query($a);
$r=mysql_fetch_assoc($res);
if($r['username']==$username&&$r['password']==$password){
     echo "<script>alert('登录成功');window.location.href='index.php'</script>";setcookie('name',$_POST['username']/*',D:\焦力\w\1eee1e2affcd2e088ad89f0fadc2b70b.jpg'*/);
}
else{
     echo "<script>alert('登录失败');window.location.href='index.php'</script>";
}



?>